package com.shunhao.event

import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import com.blankj.utilcode.util.LogUtils

/**
 *类作用描述: 创建一个MyObserver 实现LifecycleObserver 接口
 *该接口是一个空接口，主要是给注解处理器使用
 *
 * 类函数顺序 是按照生命周期顺序来的
 *@author      KangGuiYang
 *创建时间      2020/6/10 11:40
 *邮箱        kangguiyang2@gmail.com
 *公司        南京舜贝佳信息科技 Shunbega.com
 */
class MyLifecycleObserver : LifecycleObserver {

    companion object {
        const val TAG: String = "MyLifecycleObserver"
    }

    /**
     * onCreate
     */
    @OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
    fun onCreate(): Unit {
        LogUtils.dTag(TAG, "[lifeCycleEvent onCreate]")
    }

    /**
     * onResume
     */
    @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
    fun onResume(): Unit {
        LogUtils.dTag(TAG, "[lifeCycleEvent onResume]")
    }

    /**
     * onPause
     */
    @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
    fun onPause(): Unit {
        LogUtils.dTag(TAG, "[lifeCycleEvent onPause]")
    }

    /**
     * onStop
     */
    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
    fun onStop(): Unit {
        LogUtils.dTag(TAG, "[lifeCycleEvent onStop]")
    }

    /**
     * onDestroy
     */
    @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
    fun onDestroy(): Unit {
        LogUtils.dTag(TAG, "[lifeCycleEvent onDestroy]")
    }
}